/*
 * Copyright (c) 2011-2012 www.iflytek.com. All Rights Reserved.
 *  This software for customer relationship management system, developed by Iflytek_ZY team.
 *  Software code and design for the team, copy rights reserved.
 */

/**
 * 工具条插件
 */
;(function($){
    $.extend({
        "toolControl":function(options){
            options=$.extend({
                listNode:'问题',
                listUrl:'issue/list',
                createNode:'新建问题',
                createUrl:'issue/add'
            },options);
            var templater = '<div class="tool-view"><div class="tool-left"><span class="icon-open"></span></div>'+
                '<div class="tool-right"><div class="tool-content">使用反馈'+
                '<a id="btnList" href="#"><span class="icon-list"></span>&nbsp;<span class="list_font">'+options.listNode+'</span></a>'+
                '<a id="btnCreate" href="#"><span class="icon-create"></span>&nbsp;<span class="create_font">'+options.createNode+'</span></a>'+
                '</div><div class="tool-tip hide"><span class="icon-list"></span></div></div></div>';
            $('body').append(templater);
            $('.tool-left').toggle(function(){
                $('.tool-content').hide();
                $('.tool-tip').show();
                $('.tool-left').find('span').removeClass('icon-open').addClass('icon-hide');
            },function(){
                $('.tool-content').show();
                $('.tool-tip').hide();
                $('.tool-left').find('span').removeClass('icon-hide').addClass('icon-open');
            });

            $('#btnList').click(function(){
                window.open(options.listUrl);
            });

            $('#btnCreate').click(function(){
                window.open(options.createUrl);
            });
        }
    });
})(jQuery);


$(function(){
    $.toolControl();
});